<template>
  <view class="goodlistitem">
    <view class="left">
      <radio :checked="goods.goods_state" color="#c00000" @click="dkaig" v-if="kaiguan"></radio>
      <image :src="goods.goods_small_logo || defualt" ></image>
    </view>
    <view class="right">
      <view class="name">{{goods.goods_name}}</view>
      <view class="aa">
        <text>￥{{goods.goods_price | two_d}}</text>
        <uni-number-box :min="1" :value="goods.goods_count" v-if="kaiguan" @change="hahz"></uni-number-box>
      </view>
    </view>
  </view>
  
</template>
<script>
  export default{
    props:{
      goods:{
        type:Object,
        default:{}
      },
      kaiguan:{
        tyoe:Boolean,
        default:false
      }
    },
    data(){
      return{
        defualt:'/static/tabicon/img1.jpg',
      }
    },
    //过滤属性可以用|传值
    filters:{
      two_d(num){
        return Number(num).toFixed(2)
      }
    },
    methods:{
      dkaig(e){
        this.goods.goods_state=!this.goods.goods_state
        this.$emit('radio-change',{goods_id:this.goods.goods_id,goods_state:this.goods.goods_state})
       
      },
      hahz(a){
        this.$emit('mun-change',{goods_id:this.goods.goods_id,goods_count:a})
      }
    }
  }
</script>
<style lang=scss>
  .goodlistitem{
    padding: 5px 0;
    display: flex;
    border-bottom: 1px solid #f7f7f7;
    
  }
    .left{
      margin: 0 5px;
      display: flex;
      justify-content: center;
      align-items: center;
      
      image{
              width: 100px;
              height: 100px;
              }
      
    }
    .right{
      display:flex;
      flex-direction: column;
      justify-content: space-between;
       .name{
                font-size: 15px;
              }
        .aa{
          display:flex;
          justify-content: space-between;
          text{
                   color:#c00000;
                 } 
        }
         
    }

</style>
